/**
 * Copyright (c) 2006-2007 Jinyi.lu
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of GNU LGPL license by gun.org
 * which accompanies this distribution, and is available at
 * http://gnu.feld-it.at/copyleft/lesser.html
 * 
 * Project Homepage : http://code.google.com/p/demou
 * Source Code: svn checkout http://demou.googlecode.com/svn/trunk/ demou
 * Mailing list : jinyi.lu@gmail.com
 *                stonelu@126.com
 *
 *  
 * Contributors:
 *     JinYi.Lu - initial API and implementation
 */
package cn.tworen.demou.io.flv;

import cn.tworen.demou.cmd.DataType;

/**
 * Created on  2007-1-24
 *
 * Title       : AudioData.java
 * Description : 
 * 
 * @author     : LuJinYi
 * @version    : 1.0
 * @Date       : 2007-1-24
 * History     : 
 * 
 */
public class AudioData extends AbsTag implements IAudioData{
	public enum SoundFormat{
		uncompressed(0),
		ADPCM(1),
		MP3(2),
		Nellymoser8kHzmono(5),
		Nellymoser(6);
		public int value = 0;
		private SoundFormat(int value) {
			this.value = value;
		}
		public static SoundFormat getSoundFormat(int value){
			switch(value) {
			case 0:
				return uncompressed;
			case 1:
				return ADPCM;
			case 2:
				return MP3;
			case 5:
				return Nellymoser8kHzmono;
			case 6:
				return Nellymoser;
			default:
				return null;
			}
		}
	}
	public enum SoundRate{
		kHz55(0),
		kHz11(1),
		kHz22(2),
		kHz44(3);
		public int value = 0;
		private SoundRate(int value) {
			this.value = value;
		}
		public static SoundRate getSoundRate(int value){
			switch(value) {
			case 0:
				return kHz55;
			case 1:
				return kHz11;
			case 2:
				return kHz22;
			case 3:
				return kHz44;
			default:
				return null;
			}
		}
	}
	public enum SoundSize{
		snd8Bit(0),
		snd16Bit(1);
		public int value = 0;
		private SoundSize(int value) {
			this.value = value;
		}
		public static SoundSize getSoundSize(int value){
			switch(value) {
			case 0:
				return snd8Bit;
			case 1:
				return snd16Bit;
			default:
				return null;
			}
		}
	}
	public enum SoundType{
		sndMono(0),
		sndStereo(1);
		public int value = 0;
		private SoundType(int value) {
			this.value = value;
		}
		public static SoundType getSoundType(int value){
			switch(value) {
			case 0:
				return sndMono;
			case 1:
				return sndStereo;
			default:
				return null;
			}
		}
	}
	private SoundFormat soundFormat = null;
	private SoundRate soundRate = null;
	private SoundSize soundSize = null;
	private SoundType soundType = null;
	
	public AudioData() {
		this.type = DataType.AUDIO_DATA;
	}
	/**
	 * @hibernate.property
	 * @return Returns the soundFormat.
	 */
	public SoundFormat getSoundFormat() {
		return soundFormat;
	}
	/**
	 * @param soundFormat the soundFormat to set
	 */
	public void setSoundFormat(int value) {
		this.soundFormat = SoundFormat.getSoundFormat(value);
	}
	/**
	 * @hibernate.property
	 * @return Returns the soundRate.
	 */
	public SoundRate getSoundRate() {
		return soundRate;
	}
	/**
	 * @param soundRate the soundRate to set
	 */
	public void setSoundRate(int value) {
		this.soundRate = SoundRate.getSoundRate(value);
	}
	/**
	 * @hibernate.property
	 * @return Returns the soundSize.
	 */
	public SoundSize getSoundSize() {
		return soundSize;
	}
	/**
	 * @param soundSize the soundSize to set
	 */
	public void setSoundSize(int value) {
		this.soundSize = SoundSize.getSoundSize(value);
	}
	/**
	 * @hibernate.property
	 * @return Returns the soundType.
	 */
	public SoundType getSoundType() {
		return soundType;
	}
	/**
	 * @param soundType the soundType to set
	 */
	public void setSoundType(int value) {
		this.soundType = SoundType.getSoundType(value);
	}
}
